package com.nbufe.listener;

import com.nbufe.service.BaseService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 消费者,用于消费队列信息
 * @author luzhiheng
 */
@Component
@RabbitListener(queues = "TenantDirectQueue")//监听的队列名称 TestDirectQueue
public class DirectConsumer {

    @Resource
    private BaseService baseService;

    @RabbitHandler
    public void process(Long tenantId) {
        System.out.println("DirectReceiver消费者收到消息  : " + tenantId);
        baseService.initTenantData(tenantId);
    }

}